/* 学习目标：掌握-创建store，设置state初始值 获取state  */

// 前置： npm i redux
// 1. 导入createStore
import { legacy_createStore as createStore } from 'redux';

// 2. 声明reducer函数， 给state设置初始值
function xxxReducer(state = { count: 0, msg: 'hello React' }) {
  // 💥💥
  return state;
}
// 3. 调用creatStore, 创建store-数据仓库
const store = createStore(xxxReducer);

// 4. 能store.getState()获取state的值
const state = store.getState();
console.log('state  ----->  ', state);
